/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package caintra.Sapra.Pantalla.QuincenalMensual;

import caintra.Sapra.ComponentsImplements.LabelCaintra;
import caintra.Sapra.ComponentsImplements.TableCaintra;
import caintra.Sapra.Model.Practicante;
import java.util.ArrayList;
import nextapp.echo2.app.Border;
import nextapp.echo2.app.Button;
import nextapp.echo2.app.Color;
import nextapp.echo2.app.Column;
import nextapp.echo2.app.ContentPane;
import nextapp.echo2.app.Extent;
import nextapp.echo2.app.Grid;
import nextapp.echo2.app.event.ActionEvent;
import nextapp.echo2.app.event.ActionListener;
import nextapp.echo2.webcontainer.ActionProcessor;

/**
 *
 * @author Administrador
 */
public class PrefacturaDetailViewQM extends ContentPane{
    public Grid g;
    public LabelCaintra nombre,nombre_txt;
    public TableCaintra table_detalle;
    public Practicante p_detalle;
    public ArrayList<Practicante> lista_detalle;
     //public ArrayList<Practicante> lista_detalle2;
    public PrefacturaMControllerQM prefactura;
    public Column orden_comp;
    public String key_practicante;
    public Button exit;

    public PrefacturaDetailViewQM(PrefacturaMControllerQM prefactura) {
        try {
                this.prefactura=prefactura;
                this.p_detalle=this.prefactura.p_sel;
                this.lista_detalle=this.prefactura.Lista_Detalle;
                //this.lista_detalle2=this.prefactura.Lista_Detalle2;
                inicializar();
                initComponents();
                new PrefacturaDetailControllerQM(this);
        } catch (Exception e) {

        }


    }

    public void initComponents(){
        try {
            orden_comp=new Column();
            orden_comp.add(nombre);
            orden_comp.add(table_detalle);
            orden_comp.add(exit);
            this.setBackground(new Color(229, 229, 228));
            add(orden_comp);
        } catch (Exception e) {

        }
    }

    public void inicializar(){
        try {
            nombre=new LabelCaintra("label_Nombre", Color.BLACK);
            key_practicante=nombre.getText();
            nombre_txt=new LabelCaintra("", Color.BLACK);
            table_detalle=new TableCaintra("detail_table", 800);
            exit=new Button("Salir");
            exit.setWidth(new Extent(100));
            exit.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    Exit(e);
                }
            });
        } catch (Exception e) {

        }

        exit.setBorder(new Border(new Extent(1), Color.BLACK, Border.STYLE_SOLID));


    }

    public void Exit(ActionEvent e){
        if(this.prefactura.per==1){
                        this.prefactura.vista.window_detail.setModal(false);
                        this.prefactura.vista.window_detail.setVisible(false);
                        this.prefactura.vista.window_detail.removeAll();
                        this.prefactura.vista.prac_tab.removeAll();
                        this.prefactura.vista.window_pref_per.setEnabled(true);
                        this.prefactura.establecerPer1();

                        }
                        if(this.prefactura.per==2){
                        this.prefactura.vista.window_detail.setModal(false);
                        this.prefactura.vista.window_detail.setVisible(false);
                        this.prefactura.vista.window_detail.removeAll();
                        this.prefactura.vista.prac_tab2.removeAll();
                        this.prefactura.vista.window_pref_per.setEnabled(true);
                        this.prefactura.establecerPer2();
                        }
    }



}

